%li.user.media
  .media-left
    - if user.person
      .media-object
        = person_image_tag(user.person, size: :thumb_small)
  .media-body
    .row
      .col-sm-7
        %h4.media-heading
          = user.try(:person).try(:name)
      .col-sm-5
        .pull-right
          %span.label.label-default
            = t(".id")
            = user.id
          %span.label.label-info
            = t(".guid")
            = user.try(:person).try(:guid)
    .row
      .col-sm-8
        %dl.dl-horizontal
          %dt= t("username")
          %dd= user.username
          %dt= t(".email")
          %dd= user.email
          %dt= t(".diaspora_handle")
          %dd= user.person.diaspora_handle
          %dt= t(".last_seen")
          %dd= user.last_seen || t(".unknown")
          - if user.invited_by.present?
            %dt= t(".invite_token")
            %dd= invite_code_url(user.invited_by.invitation_code)
          %dt= t(".account_closed")
          %dd
            - if user.person.closed_account
              %span.label.label-warning= t(".yes")
            - else
              %span.label.label-success= t(".no")
          %dt= t(".nsfw")
          %dd
            - if user.person.profile.nsfw
              %span.label.label-warning= t(".yes")
            - else
              %span.label.label-success= t(".no")

        %h4= t("layouts.header.profile")

        %dl.dl-horizontal
          %dt= t("people.profile_sidebar.born")
          %dd= user.person.profile.birthday
          %dt= t("people.profile_sidebar.gender")
          %dd= user.person.profile.gender
          %dt= t("people.profile_sidebar.location")
          %dd= user.person.profile.location
          %dt= t("people.profile_sidebar.bio")
          %dd= user.person.profile.bio

      .col-sm-4
        = link_to t("admins.user_search.view_profile"),
          person_path(user.person),
          class: "btn btn-default btn-block"
        = link_to t("admins.user_search.add_invites"),
          add_invites_path(user.invitation_code),
          class: "btn btn-info btn-block"
        - unless user.person.closed_account
          = link_to t("admins.user_search.close_account"),
            admin_close_account_path(user),
            method: :post, data: {confirm: t("admins.user_search.are_you_sure")},
            class: "btn btn-danger btn-block"
          - if user.access_locked?
            = link_to t("admins.user_search.unlock_account"),
              admin_unlock_account_path(user),
              method: :post,
              data: {confirm: t("admins.user_search.are_you_sure_unlock_account")},
              class: "btn btn-danger btn-block"
          - else
            = link_to t("admins.user_search.lock_account"),
              admin_lock_account_path(user),
              method: :post,
              data: {confirm: t("admins.user_search.are_you_sure_lock_account")},
              class: "btn btn-danger btn-block"
